<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Doxygen manual for MemAlloc: MemAlloc Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Doxygen manual for MemAlloc
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classMemAlloc-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">MemAlloc Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Memory Allocator interface class.  
 <a href="classMemAlloc.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="memalloc_8hpp_source.html">memalloc.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae246263fcde28c27cfccf1fc18d4c3ae"><td class="memTemplParams" colspan="2">template&lt;class T &gt; </td></tr>
<tr class="memitem:ae246263fcde28c27cfccf1fc18d4c3ae"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classSmartPtr.html">SmartPtr</a>&lt; T &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classMemAlloc.html#ae246263fcde28c27cfccf1fc18d4c3ae">Alloc</a> (size_t elem_count=1)</td></tr>
<tr class="memdesc:ae246263fcde28c27cfccf1fc18d4c3ae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Memory Allocate function.  <a href="#ae246263fcde28c27cfccf1fc18d4c3ae">More...</a><br/></td></tr>
<tr class="separator:ae246263fcde28c27cfccf1fc18d4c3ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2a0f4a1426bba45b46d7706c7dcbb89d"><td class="memTemplParams" colspan="2">template&lt;class T &gt; </td></tr>
<tr class="memitem:a2a0f4a1426bba45b46d7706c7dcbb89d"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classMemAlloc.html#a2a0f4a1426bba45b46d7706c7dcbb89d">Free</a> (const <a class="el" href="classSmartPtr.html">SmartPtr</a>&lt; T &gt; &amp;ptr)</td></tr>
<tr class="memdesc:a2a0f4a1426bba45b46d7706c7dcbb89d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Memory Free function.  <a href="#a2a0f4a1426bba45b46d7706c7dcbb89d">More...</a><br/></td></tr>
<tr class="separator:a2a0f4a1426bba45b46d7706c7dcbb89d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a0aec1afcebdd8b7bb9920326bbc733ac"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMemAlloc.html#a0aec1afcebdd8b7bb9920326bbc733ac">Init</a> (size_t mem_size, size_t swap_size, const std::string &amp;swap_path)</td></tr>
<tr class="separator:a0aec1afcebdd8b7bb9920326bbc733ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a386499c433d4190715c1ed701bb5eb6e"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classMemAlloc.html">MemAlloc</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMemAlloc.html#a386499c433d4190715c1ed701bb5eb6e">Instance</a> ()</td></tr>
<tr class="memdesc:a386499c433d4190715c1ed701bb5eb6e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Instance function returns correct <a class="el" href="classMemAlloc.html" title="Memory Allocator interface class.">MemAlloc</a>&amp;.  <a href="#a386499c433d4190715c1ed701bb5eb6e">More...</a><br/></td></tr>
<tr class="separator:a386499c433d4190715c1ed701bb5eb6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af50d45b65c86135773b24cb47757dadb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af50d45b65c86135773b24cb47757dadb"></a>
static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classMemAlloc.html#af50d45b65c86135773b24cb47757dadb">Deinit</a> ()</td></tr>
<tr class="memdesc:af50d45b65c86135773b24cb47757dadb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deinitialize <a class="el" href="classMemAlloc.html" title="Memory Allocator interface class.">MemAlloc</a>. <br/></td></tr>
<tr class="separator:af50d45b65c86135773b24cb47757dadb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Memory Allocator interface class. </p>
<p>To use <a class="el" href="classMemAlloc.html" title="Memory Allocator interface class.">MemAlloc</a> class for memory management you should first call Init method. Finaly you should call Deinit method. To allocate some memory you should use Alloc call and next play a lot with <a class="el" href="classSmartPtr.html" title="SMartPtr interface class.">SmartPtr</a>'s. When you suppose that you don't need memory, please call Free method. Please, look for <a class="el" href="classSmartPtr.html" title="SMartPtr interface class.">SmartPtr</a> documentation for more information. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ae246263fcde28c27cfccf1fc18d4c3ae"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classSmartPtr.html">SmartPtr</a>&lt;T&gt; MemAlloc::Alloc </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>elem_count</em> = <code>1</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Memory Allocate function. </p>
<p>Call to this function allocates arrey of elem_count elements of type T and returns SmartPtr&lt;T&gt; to acess allocated memory. Default array size is 1. </p>

</div>
</div>
<a class="anchor" id="a2a0f4a1426bba45b46d7706c7dcbb89d"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void MemAlloc::Free </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classSmartPtr.html">SmartPtr</a>&lt; T &gt; &amp;&#160;</td>
          <td class="paramname"><em>ptr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Memory Free function. </p>
<p>Please be carefull with this function to prevent double-free. </p>

</div>
</div>
<a class="anchor" id="a0aec1afcebdd8b7bb9920326bbc733ac"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void MemAlloc::Init </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>mem_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>swap_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>swap_path</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Init function. This function must be called before the first call to Alloc; Please, don't forget to call Deinit after Init</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mem_size</td><td>RAM limit for allocator </td></tr>
    <tr><td class="paramname">swap</td><td>size for allocaor </td></tr>
    <tr><td class="paramname">swap_path</td><td>file path and name</td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>exception on out-of-memory </td></tr>
    <tr><td class="paramname">std::ios_base::failure</td><td>for file error </td></tr>
    <tr><td class="paramname"><a class="el" href="classMemAllocException.html" title="General exception class for MemAlloc.">MemAllocException</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a386499c433d4190715c1ed701bb5eb6e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classMemAlloc.html">MemAlloc</a>&amp; MemAlloc::Instance </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Instance function returns correct <a class="el" href="classMemAlloc.html" title="Memory Allocator interface class.">MemAlloc</a>&amp;. </p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classMemAllocException.html" title="General exception class for MemAlloc.">MemAllocException</a></td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>/home/oponomarev/workspace/parallels-ip-2014/trunk/interfaces/<a class="el" href="memalloc_8hpp_source.html">memalloc.hpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Apr 7 2014 12:04:10 for Doxygen manual for MemAlloc by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>
